package models

import "time"

type Category struct {
	ID            uint64    `gorm:"primaryKey;comment:分类ID"`
	PID           uint64    `gorm:"default:0;index;comment:父分类ID"`
	Name          string    `gorm:"type:varchar(50);not null;index;comment:分类名称"`
	Thumbnail     string    `gorm:"type:varchar(200);comment:分类缩略图"`
	Description   string    `gorm:"type:varchar(300);comment:分类描述"`
	Sort          int       `gorm:"default:100;index;comment:排序值"`
	Status        int8      `gorm:"default:1;index;comment:状态 1正常 0禁用"`
	IsRecommended bool      `gorm:"default:0;index;comment:是否推荐"`
	ArticleCount  uint      `gorm:"default:0;index;comment:包含文章数"`
	CreatedAt     time.Time `gorm:"autoCreateTime;comment:创建时间"`
	UpdatedAt     time.Time `gorm:"autoUpdateTime;comment:更新时间"`
}

func (Category) TableName() string {
	return "categories"
}
